#define _CRT_SECURE_NO_WARNINGS 1
int* intersection(int* nums1, int nums1Size, int* nums2, int nums2Size, int* returnSize) {
    int* arr = (int*)malloc(sizeof(int) * (nums1Size + nums2Size));
    int i = 0;
    int j = 0;
    int w = 0;
    int flag = 0;
    for (i = 0; i < nums1Size; i++)
    {
        for (j = 0; j < nums2Size; j++)
        {
            if (nums1[i] == nums2[j])
            {
                int t = 0;
                for (w = 0; w <= flag; w++)
                {
                    if (arr[w] == nums1[i])
                    {
                        t = 1;
                        break;
                    }
                }
                if (t == 0)
                    arr[flag++] = nums1[i];
            }
        }
    }
    *returnSize = flag;
    return arr;
}